﻿//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Web;
//using System.Web.UI;
//using System.Web.UI.WebControls;

//namespace CTEA_INDIA
//{
//    public partial class Artist_Coordinator : System.Web.UI.Page
//    {

//        protected void Page_Load(object sender, EventArgs e)
//        {
//            cmbTypeOfArtist.SelectedIndex = 0;
//        }

//        protected void Button1_Click(object sender, EventArgs e)
//        {
//            string ArtistName = txtArtistName.Text;
//            string ArtistCategoty = cmbArtistCategory.Text;
//            string Location = txtLocation.Text;
//            string Age = txtAge.Text;
//            string Email = txtEmail.Text;
//            string TypeOFArtist = cmbTypeOfArtist.Text;



//            string RefCompany = txtRefCompName.Text;
//           // string RefCOntact = txtRefContact.Text;
//            string TechnicianType = cmbTechType.Text;

//            spnMsg.Visible = true;
//            spnText.InnerHtml = "Your details have been submitted.";

//            txtArtistName.Text = "";
//            cmbArtistCategory.SelectedIndex = 0;
//            txtLocation.Text = "";
//            txtAge.Text = "";
//            txtEmail.Text = "";
//            cmbTypeOfArtist.SelectedIndex = 0;


//            //ftpPicUpload.;
//            //ftpPicUpload2.FileName;
//            //ftpPicUpload3.FileName;
//            //ftpPicUpload4.FileName;
//            //ftpPicUpload5.FileName;

//            txtRefCompName.Text = "";
//            txtRefContact.Text = "";
//            cmbTechType.SelectedIndex = 0;

//        }

//        protected void btnAddFile_Click(object sender, EventArgs e)
//        {
//            if (fileUp.PostedFile.ContentLength > 0)
//            {
//                ////TODO: logic for file extension check
//                //DataRow dr = dsPhotosFiles.Tables[0].NewRow();

//                //string fileExt = System.IO.Path.GetExtension(fileUp.PostedFile.FileName);

//                //byte[] imageBytes = new byte[fileUp.PostedFile.InputStream.Length];
//                //fileUp.PostedFile.InputStream.Read(imageBytes, 0, imageBytes.Length);
//                //string fileName = fileUp.FileName;
//                //fileUp.SaveAs(Server.MapPath("PrintImages/" + fileName));


//                //dr["fileBytes"] = imageBytes;
//                //dr["filePath"] = fileUp.PostedFile.FileName;
//                //dr["fileDesc"] = txtDescImg.Text;
//                //dr["id"] = System.Guid.NewGuid().ToString();

//                //dsPhotosFiles.Tables[0].Rows.Add(dr);
//            }

//            //this.bindDataList();

//            //txtDescImg.Text = "";
//            //lblCurrentFileCount.Text = "Current Files To Upload: " + dsPhotosFiles.Tables[0].Rows.Count;
//        }

//        protected void btnUploadFiles_Click(object sender, EventArgs e)
//        {

//            try
//            {
//                //for (int i = 0; i < dsPhotosFiles.Tables[0].Rows.Count; i++)
//                //{
//                    ////TODO:logic to save image path and description to database

//                    //string fileName = System.IO.Path.GetFileName(dsPhotosFiles.Tables[0].Rows[i]["filePath"].ToString());



//                    //byte[] imageBytes;
//                    //imageBytes = (byte[])dsPhotosFiles.Tables[0].Rows[i]["fileBytes"];
//                    //int useri_id = Convert.ToInt32(Session["UserID"]);
//                    //string Descr = txtDescr.Text;
//                    //string rate = "100";
//                    //string qty = txtQty.Text;
//                    //string DescrImg = dsPhotosFiles.Tables[0].Rows[i]["fileDesc"].ToString();
//                    //int OrderId = BAL.Service.GetOrderID(useri_id, Descr, rate, qty);





//                    ////their is no uploading..just writing out the bytes to the directory on the web server.
//                    //// System.IO.File.WriteAllBytes(Server.MapPath(string.Format("~/documents/{0}", fileName)), imageBytes);
//                    //BAL.Service.UploadImages(fileName, useri_id, OrderId, DescrImg);
//                    //spnImg.Style.Add("display", "block");
//                    //spnImg.InnerHtml = "Image(s) inserted Successfully";

//                    //// Response.Redirect("OrderDetails.aspx");

//                //}

//                ////TODO: show success message logic

//                ////clear out rows of dataset not the whole dataset
//                //dsPhotosFiles.Tables[0].Rows.Clear();
//                //this.bindDataList();
//                //lblCurrentFileCount.Text = "Current Files To Upload: " + "0";



//            }
//            catch (Exception ex)
//            {
//                //TODO: show error message of which file did not get uploaded
//                throw new Exception(ex.Message);
//            }

//        }

//        private void initPhotoDS()
//        {
//            //dsPhotosFiles.Tables.Add("Photos");
//            //dsPhotosFiles.Tables[0].Columns.Add("fileBytes", Type.GetType("System.Byte[]"));
//            //dsPhotosFiles.Tables[0].Columns.Add("filePath");
//            //dsPhotosFiles.Tables[0].Columns.Add("fileDesc");
//            //dsPhotosFiles.Tables[0].Columns.Add("id");
//        }

//        private void bindDataList()
//        {
//            //dlPhotoFiles.DataSource = dsPhotosFiles;
//            //dlPhotoFiles.DataKeyField = "id";
//            //dlPhotoFiles.DataBind();
//        }

//        protected void lnkBtnRemovePhoto_Command(object sender, CommandEventArgs e)
//        {

//            //foreach (DataRow dr in dsPhotosFiles.Tables[0].Rows)
//            //{
//            //    if (dr["id"].ToString() == e.CommandArgument.ToString())
//            //    {
//            //        dsPhotosFiles.Tables[0].Rows.Remove(dr);
//            //        break;
//            //    }

//            //}

//            //this.bindDataList();
//            //lblCurrentFileCount.Text = "Current Files To Upload: " + dsPhotosFiles.Tables[0].Rows.Count;
//        }

//    }
//}